package com.lovo.project2.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lovo.project2.bean.SuppilerBean;
import com.lovo.project2.service.ISuppilerBeanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/suppiler")
public class SuppilerBeanController {
    @Autowired
  ISuppilerBeanService iSuppilerBeanService;

    @RequestMapping("queryall")
    IPage<SuppilerBean> queryAll(int pg,int pgsize,String supName,String rangle){
        IPage iPage=new Page(pg,pgsize);
        return iSuppilerBeanService.queryPageByItem(iPage,supName,rangle);
    }

@RequestMapping("querySuById")
    SuppilerBean querySuById(int id){

        return iSuppilerBeanService.seleceSuppilerById(id);
    }

    @RequestMapping("updateSupp")
  String updateSupp(@RequestBody SuppilerBean suppilerBean)  {
iSuppilerBeanService.updateSuppilerBean(suppilerBean);

        return "ok";
  }

  @RequestMapping("addSupp")
  String addSupp(@RequestBody SuppilerBean suppilerBean){

   iSuppilerBeanService.addSuppilerBean(suppilerBean);

        return "ok";
  }



}
